package com.ljy.my_study.文件操作;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

/** 
* @author James
* @date 2018年9月6日 
*/
public class TestMain {
	public static void main(String[] args) throws IOException {
		String path="C:\\Users\\hasee\\Desktop\\sub\\表一字段.txt";
		BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(path)));
		StringBuilder sb=new StringBuilder();
		String line=null;
		while((line=br.readLine())!=null) {
			System.out.println(line);
			String[] lineArr=line.split("(\\s){1}|(\\t){1}");
			if(lineArr.length>1) {
				sb.append(""+lineArr[0].trim()+",");
			}else {
				sb.append("null as "+line.trim()+",");
			}
			System.out.println("--"+lineArr.length+"--"+lineArr[0]);
		}
		System.out.println("-------------------");
		System.out.println(sb.toString());
	}
}
